package com.education.controller;

import com.education.domain.Tbclass;
import com.education.service.ClassService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * Created by zhangjiawen on 2019/11/19.
 */
@RestController
@RequestMapping("/class")
public class ClassController {
    Logger logger= LoggerFactory.getLogger(this.getClass());
    @Autowired
    private ClassService classService;


    @RequestMapping("/getByCondition")
    public  Object selectByExample(@RequestBody Map map) {
        if (map.size()==0){
            return null;
        }
        int count=0;
        Tbclass cls=new Tbclass();
        if(map.get("lTermId")!=null){
            cls.setLtermid(Integer.parseInt((String) map.get("lTermId")));
            count++;
        }
        if(map.get("lHeadmasterId")!=null){
            cls.setLheadmasterid(Integer.parseInt((String) map.get("lHeadmasterId")));
            count++;
        }
        if (count==0){
            return null;
        }

        return  classService.getByCondition(cls);

    }






}
